package homework.test02;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class demo02 {
    public static void main(String[] args) {
        String s0 = "刘备字玄德 诸葛亮字孔明 曹操字孟德 孙权字仲谋 关羽字云长 张飞字翼德 赵云字子龙 乐进字文谦 李典字曼成 曹仁字子孝 曹洪字子廉";
        String[] s1 = s0.split(" ");
        System.out.println(Arrays.toString(s1));
        System.out.println("+++++++++++++++++++++++++++++++++++++++++++");
        Stream<String> s2 = Arrays.stream(s1);
        Map<String, String> map = s2.collect(Collectors.toMap(
                a ->
                    a.split("字")[0]
                ,
                a ->
                     a.split("字")[1]
                ));

        map.forEach((k,v)-> System.out.println(k+" "+v));
    }
}
